package com.ashbur.mybatis.test;


import com.ashbur.mybatis.binding.MapperProxyFactory;
import com.ashbur.mybatis.test.dao.IUserDao;


import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.HashMap;
import java.util.Map;

/**
 * @author : Eumenides
 * @Description :
 * @date : 2022/7/15
 * @Copyright ： 公众号：菜鸟的大厂梦
 */
public class test_case_01 {

    private Logger logger = LoggerFactory.getLogger(test_case_01.class);

    @Test
    public void test_MapperProxyFactory() {

        MapperProxyFactory<IUserDao> factory = new MapperProxyFactory<>(IUserDao.class);
        Map<String,String> sqlSession = new HashMap<>();

        sqlSession.put("com.ashbur.mybatis.test.dao.IUserDao.queryUserName", "模拟执行 Mapper.xml 中 SQL 语句的操作：查询用户姓名");
        sqlSession.put("com.ashbur.mybatis.test.dao.IUserDao.queryUserAge", "模拟执行 Mapper.xml 中 SQL 语句的操作：查询用户年龄");

        IUserDao userDao = factory.newInstance(sqlSession);
        String res = userDao.queryUserName("10001");
        
        logger.error("测试结果：{}", res);

    }

}
